package com.swotxu.mall.auth.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Date: 2021/2/15 17:38
 * @Author: swotXu
 */
@Configuration
public class MallWebConfig implements WebMvcConfigurer {

    /**
     * 视图映射, 通过 ViewControllerRegistry 配置，替代下面空方法的页面跳转。
     *
     *     @GetMapping({"/", "/login.html"})
     *     public String loginPage() {
     *         return "login";
     *     }
     *
     * @param registry
     */
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        // registry.addViewController("/login.html").setViewName("login");
        registry.addViewController("/reg.html").setViewName("reg");
    }
}
